Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makefile.m32: add support for custom ARCH [ci skip] #9092

Closed
wants to merge 1 commit into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Jul 3, 2022

When building curl for target platform other than x64 and x86, it is now
possible to pass ARCH=custom, that will omit all hardcoded logic for
setting up CFLAGS/LDFLAGS/RCFLAGS for these platforms, and let these be
customized via CURL_CFLAG_EXTRAS, CURL_LDFLAG_EXTRAS, and a newly
added one for the resource compiler: CURL_RCFLAG_EXTRAS.

This makes it possible to use makefile.m32 to build for ARM64 for
example.

When building curl for target platform other than x64 and x86, it is now
possible to pass `ARCH=custom`, that will omit all hardcoded logic for
setting up CFLAGS/LDFLAGS/RCFLAGS for these platforms, and let these be
customized via `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, and a newly
added one for the resource compiler: `CURL_RCFLAG_EXTRAS`.

This makes it possible to use `makefile.m32` to build for ARM64 for
example.
@vszakats vszakats added build Windows Windows-specific labels Jul 3, 2022
vszakats added a commit to curl/curl-for-win that referenced this pull request Jul 3, 2022
Using the excellent llvm-mingw project [1] by @mstorsjo to implement
ARM64 support for curl-for-win builds.

ARM64 requires UCRT (this will not change) and clang (this may change
when GCC toolchains get ready for it.)

One small snag is OpenSSL, which doesn't have a native way for ARM64
support with mingw, so we use its `mingw64` mode with `no-asm` as a
workaround, which will affect performance.

ARM64 builds are not yet enabled in the CI machine. This will happen
in future commits.

For now this needs downloading llvm-mingw as a binary on each platform
and pointing the `CW_LLVM_MINGW_PATH` variable to it. llvm-mingw will
only be used for ARM64 targets for now, making versions listed in the
manifest a bit confusing.

Short of a CPU+VM or real machine to run ARM64 Windows apps, I have no
way to tell if the resulting binaries are correct or run at all. But
they for sure link cleanly.

Applied a pending PR to support ARM64 with Makefile.m32: [2]. Plus
an earlier patch to make it apply cleanly [3].

[1] https://github.com/mstorsjo/llvm-mingw
[2] curl/curl#9092
[3] curl/curl@c7f53b7
vszakats added a commit to curl/curl-for-win that referenced this pull request Jul 4, 2022
Test build with binaries here: [0]

Using the excellent llvm-mingw project [1] by @mstorsjo to implement
ARM64 support for curl-for-win builds.

ARM64 requires UCRT (this will not change) and clang (this may change
when GCC toolchains get ready for it.)

llvm-mingw is automatically downloaded, installed and used if
`CW_DL_LLVM_MINGW` is set. Existing llvm-mingw is used if envvar
`CW_LLVM_MINGW_PATH` is pointing to its directory. llvm-mingw is only
used for ARM64 targets for now. To make versions listed in the global
manifest `build.txt` less confusing, ARM64 tools are marked as such.

One small snag is OpenSSL, which doesn't have a native way for ARM64
support with mingw, so we use a slightly modified `mingw64` mode with
`no-asm` as a workaround, which affects performance. LibreSSL builds fine
out of the box.

Short of a CPU+VM or real machine to run ARM64 Windows apps, I have no
way to tell if the resulting binaries are correct or run at all. But,
they link cleanly. I also have not tested a build on Windows, only on
Linux and macOS.

ARM64 builds are now enabled for CI builds. One potential problem is
builds taking very long now. With x64+x86 using Makefile.m32, a typical
time was 25-30 minutes. With x64+x86+a64 using CMake, it's 50 minutes,
which may hit CI limits. Can be mitigated by switching back to faster
Makefile.m32 builds from CMake for curl.

Applied a pending PR to support ARM64 with Makefile.m32: [2]. Plus an
earlier patch to make that apply cleanly [3].

[0] https://ci.appveyor.com/project/curlorg/curl-for-win/builds/44062838
[1] https://github.com/mstorsjo/llvm-mingw
[2] curl/curl#9092
[3] curl/curl@c7f53b7
@vszakats vszakats closed this in 8ef0f35 Jul 4, 2022
@vszakats vszakats deleted the m32customplatform branch July 4, 2022 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Windows Windows-specific
Development

Successfully merging this pull request may close these issues.

None yet

2 participants